<?php
class SymHelper
{
	/**
	 * Returns option for country select. Countries to be first are excluded from alphabetical list
	 *
	 * @param array $arFirst countries to be first in list
	 */
	public static function AOptionsForCountrySelect( $arFirst, $selected = '', $htmlOptions = array() )
	{
	    $c = new sfCultureInfo(sfContext::getInstance()->getUser()->getCulture());
	    $countries = $c->getCountries();
	    // debugvar($arFirst);
	    $ar = array();
	    foreach( $arFirst as $key => $value )
	    {
	        $key = strtoupper($key);
	        if( empty($value) )
	        {
	        	if(!empty($countries[$key]))
	        	{
	            	$ar[$key] = $countries[$key];
	        	}
	        }else
	        {
	            $ar[$key] = $value;
	        }
	    }
//	    foreach( $countries as $key => $value )
//	    {
//	        if( empty($arFirst[$key]) )
//	            $ar[$key] = $value;
//	    }
	    // debugvar($ar);
	    return options_for_select($ar, $selected, $htmlOptions);
	}
}